import json

def analysis(d,name):
	s=dict()
	nPass=0
	s=name+'\n'
	for i in d:
		try:
			n=int(i)
			if n < 60: nPass=nPass+1
			n/=10
			if n in m:
				m[n]=m[n]+1
			else:
				m[n]=1
		except:
			if i in m:
				m[i]=m[i]+1
			else :
				m[i]=1
	for key in m:
		s+='%s %s %s'% (key,m[key],str(m[key]*100/len(d))+"%")+'\n'
	if u"不及格" not  in m.keys():
		s+=u"不及格:"+str(nPass*100/len(d))+"%\n"
	else:
		nPass=m[u"不及格"]
	l.append((nPass*100/len(d),s))


j=json.load(open("score.json"))

l=[]
for i in j:
    analysis(j[i],i)


l2=sorted(l,key = lambda s:-s[0] ) 
l3=[(i[1].encode("utf8")) for i in l2]
open("ans.json","w").write( json.dumps(l3,  ensure_ascii=False))
